import {MigrationInterface, QueryRunner} from "typeorm";

export class init1574441252653 implements MigrationInterface {
    name = 'init1574441252653'

    public async up(queryRunner: QueryRunner): Promise<any> {
        await queryRunner.query("CREATE TABLE `setting` (`id` int NOT NULL AUTO_INCREMENT, `urlApk` varchar(255) NOT NULL, `isActive` tinyint NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB", undefined);
        await queryRunner.query("CREATE TABLE `user` (`id` int NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `phone` varchar(255) NOT NULL, `notifyPostUrl` varchar(255) NOT NULL, `isAdmin` tinyint NOT NULL, `yflag` int NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB", undefined);
        await queryRunner.query("CREATE TABLE `card` (`id` int NOT NULL AUTO_INCREMENT, `link` varchar(255) NOT NULL, `openCount` int NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB", undefined);
    }

    public async down(queryRunner: QueryRunner): Promise<any> {
        await queryRunner.query("DROP TABLE `card`", undefined);
        await queryRunner.query("DROP TABLE `user`", undefined);
        await queryRunner.query("DROP TABLE `setting`", undefined);
    }

}
